package day14;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket client = new Socket("localhost", 9999);
        OutputStream os = client.getOutputStream(); //向服务端写数据
        Scanner sc = new Scanner(System.in); //数据的来源
        while (true) {
            System.out.print("请输入向服务器端写入的数据:");
            String msg = sc.nextLine();
            os.write((msg + "\n").getBytes());
        }
    }
}
